
package net.swa.system.web.action;

import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Required;
import net.swa.system.beans.entity.OperationLog;
import net.swa.system.beans.entity.User;
import net.swa.system.service.ICommonService;
import net.swa.system.util.SysConst;
import net.swa.system.util.annotation.Log;

public class LogAction extends AbstractBaseAction
{
    private ICommonService commonService;

    private Long[] ids;

    private OperationLog model;

    private String userid;

    private Boolean admin;

    private static final long serialVersionUID = -8971852540641555704L;

    //    private static final String LIST_PAGE = "net/swa/log/jsp/list.html";

    @Log(description = "查看日志")
    public String listPage() throws Exception
    {
        User u = getCurrentUser();
        if (SysConst.USER_TYPE_ADMIN == u.getUserType())
        {
            userid = "";
            admin = true;
        }
        else
        {
            userid = u.getUserid();
            admin = false;
        }
        return "listPage";
    }

    /**
    * 修改日志记录状态方法
    * @return
    * @throws Exception 
    */
    public String ShiXiao() throws Exception
    {

        commonService.commonUpdateStatus("OperationLog", ids, SysConst.SHI_XIAO);
        outSuccess();
        return null;
    }

    public ICommonService getCommonService()
    {
        return commonService;
    }

    @Resource
	@Required
    public void setCommonService(ICommonService commonService)
    {
        this.commonService = commonService;
    }

    public OperationLog getModel()
    {
        return model;
    }

    public void setModel(OperationLog model)
    {
        this.model = model;
    }

    public Long[] getIds()
    {
        return ids;
    }

    public void setIds(Long[] ids)
    {
        this.ids = ids;
    }

    public String getUserid()
    {
        return userid;
    }

    public void setUserid(String userid)
    {
        this.userid = userid;
    }

    public Boolean getAdmin()
    {
        return admin;
    }

    public void setAdmin(Boolean admin)
    {
        this.admin = admin;
    }

}
